<% 
	if (session.getAttribute("admin") == null) {
		response.sendRedirect("/kaola/admin/login.jsp");
	}
%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'list_level1_category.jsp' starting page</title>
</head>

<body>
	<a href="/kaola/admin/manage.jsp">管理者主页</a>
	<table border="1" cellspacing="0">
		<thead>
			<tr>
				<th>id</th>
				<th>name</th>
				<th>grade</th>
				<th>products</th>
				<th>delete</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="categories" var="c">
				<tr>
					<td>${c.id}</td>
					<td>${c.name}</td>
					<td>${c.grade}</td>
					<td>
						<a href="/kaola/products/list?category.id=${c.id}">products</a>
					</td>
					<td>
						<a href="/kaola/categories/destroy?category.id=${c.id}">delete</a>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
</body>
</html>